package com.logic.landseaserver.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.logic.common.exception.BusinessException;
import com.logic.common.security.SecurityUtils;
import com.logic.common.util.QueryUtil;
import com.logic.landseaserver.domain.ContractComments;
import com.logic.landseaserver.persistence.read.ContractCommentsReadMapper;
import com.logic.landseaserver.persistence.write.ContractCommentsWriteMapper;
import com.logic.landseaserver.service.IContractCommentsService;

@Service
public class ContractCommentsServiceImpl implements IContractCommentsService {
	@Autowired
	private ContractCommentsReadMapper contractCommentsReadMapper;	
	
	@Autowired
	private ContractCommentsWriteMapper contractCommentsWriteMapper;
	
	@Override
	public void delete(String arg0) throws BusinessException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Object get(Integer arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int insert(ContractComments contractComments) throws BusinessException {
		contractComments.updateCommonInfo(SecurityUtils.getCurrentLogin().getUserId());
		int id = contractCommentsWriteMapper.insertSelective(contractComments);
		return id;
	}

	@Override
	public List<?> query(QueryUtil arg0) {
		return null;
	}

	@Override
	public void update(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Boolean validate(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean validateForDelete(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean validateForInsert(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean validateForUpdate(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Object> queryByPage(QueryUtil queryUtil,Integer contractId) {
		queryUtil.getParams().put("userId", SecurityUtils.getCurrentLogin().getUserId());
		queryUtil.getParams().put("contractId", contractId);
		List<Object> dtoList = contractCommentsReadMapper.selectByPage(queryUtil);
		return dtoList;
	}

	@Override
	public int insert(Object arg0) throws BusinessException {
		// TODO Auto-generated method stub
		return 0;
	}
	
}
